package cn.wolfcode.crm.service.imp;


import cn.wolfcode.crm.domain.ProductSortTwo;
import cn.wolfcode.crm.mapper.ProductSortTwoMapper;
import cn.wolfcode.crm.service.IProductSortTwoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductSortTwoServiceImpl implements IProductSortTwoService {
    @Autowired
    private ProductSortTwoMapper productSortTwoMapper;

    @Override
    public List<ProductSortTwo> selectBySn(String sn) {
        List<ProductSortTwo> dept = productSortTwoMapper.selectBySn(sn);
        return dept;
    }

    @Override
    public List<ProductSortTwo> selectByParentSn(String sn) {
        return productSortTwoMapper.selectByParentSn(sn);
    }

    @Override

    public void deleteByPrimaryKey(Long id) {
        if (id != null) {
            productSortTwoMapper.deleteByPrimaryKey(id);
        }
    }

    @Override

    public void saveOrUpdate(ProductSortTwo entity) {
        if (entity.getId() != null) {
            //更新操作
            productSortTwoMapper.updateByPrimaryKey(entity);
        }else {
            productSortTwoMapper.insert(entity);
        }
    }

    @Override
    public ProductSortTwo selectByPrimaryKey(Long id) {
        ProductSortTwo dept = productSortTwoMapper.selectByPrimaryKey(id);
        return dept;
    }

    @Override
    public List<ProductSortTwo> selectAll() {
        List<ProductSortTwo> depts = productSortTwoMapper.selectAll();
        return depts;
    }
}
